package com.aboo.dao.impl;

import java.util.List;

import com.aboo.dao.BaseSqlMapDao;
import com.aboo.dao.FrameConstantDao;
import com.aboo.po.FrameConstantPO;
import com.aboo.po.Page;
import com.aboo.pub.constant.Constant;

public class FrameConstantDaoImpl extends BaseSqlMapDao implements FrameConstantDao {

	public Integer save(FrameConstantPO po) throws Exception {
		return (Integer) getSmcTemplate().insert("FrameConstant.insertFrameConstant", po);
	}

	public void delete(Integer id) throws Exception {
		FrameConstantPO tmp = new FrameConstantPO();
		tmp.setId(id);
		tmp.setInUse(Constant.INUSE_NO);
		getSmcTemplate().update("FrameConstant.updateFrameConstant", tmp);
	}

	public FrameConstantPO find(FrameConstantPO po) throws Exception {
		return (FrameConstantPO) getSmcTemplate().queryForObject("FrameConstant.selectFrameConstantList", po);
	}

	public Integer findCount(FrameConstantPO po) throws Exception {
		return (Integer) getSmcTemplate().queryForObject("FrameConstant.selectFrameConstantCount", po);
	}

	public List<FrameConstantPO> findList(FrameConstantPO po, Page page)
			throws Exception {
		if (page != null) {
			po.setBeginIndex(page.getBeginRecordIndex());
			po.setEndIndex(page.getEndRecordIndex());
		}
		po.addSort("ID", Constant.SORT_ASC);
		return getSmcTemplate().queryForList("FrameConstant.selectFrameConstantList", po);
	}

	public void update(FrameConstantPO po) throws Exception {
		getSmcTemplate().update("FrameConstant.updateFrameConstant", po);
	}

}
